﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;

namespace Thirteen23.TED.Converters
{
    public class MediaElementPositionConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, string typeName, object parameter, string language)
        {
            MediaElement media = parameter as MediaElement;
            return media.Position.TotalMilliseconds / media.NaturalDuration.TimeSpan.TotalMilliseconds;
        }

        public object ConvertBack(object value, string typeName, object parameter, string language)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
